package com.coocaa.x.service.litecontent.providers.store.host.com_coocaa_theme;

import android.content.Context;

import com.coocaa.x.framework.app.CoocaaApplication;

import java.io.File;

public class WallPaperController {
    private static WallPaperController instance = null;
    private static Context mContext = null;
    private String BASE_PATH = "";
    private String WALLPAPER = "";
    private String DEFAULTPAPER = "default_paper";

    public static WallPaperController getInstance() {
        if (instance == null) {
            instance = new WallPaperController(CoocaaApplication.getContext());
        }
        return instance;
    }

    public WallPaperController(Context c) {
        initPath(c);
        if (!new File(BASE_PATH).exists()) {
            new File(BASE_PATH).mkdir();
        }

        File dirFile = new File(WALLPAPER);
        if (!dirFile.exists())
            dirFile.mkdir();
    }

    public void initPath(Context c) {
        BASE_PATH = c.getFilesDir() + "/coocaalauncher/";
        WALLPAPER = BASE_PATH + "wallpaper/";
    }

    public String getWallPaperPath() {
        if (WALLPAPER.equals("")) {
            initPath(mContext);
        }
        return WALLPAPER + DEFAULTPAPER;
    }
}
